package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper extends BaseMapper<Brand> {


    @Select("SELECT \n" +
            "\tb.id, b.name, b.letter, b.image \n" +
            "FROM \n" +
            "\ttb_category_brand cb \n" +
            "INNER JOIN \n" +
            "\ttb_brand b ON b.id = cb.brand_id \n" +
            "WHERE \n" +
            "\tcb.category_id = #{id}")
    List<Brand> queryBrandByCategory(@Param("id") Long id);
}
